import time

from xinan_ui.proxy.base_page import PageHandle
from xinan_ui.tools.read_yml_xn import ReadYaml

data_eles = ReadYaml(r'D:\testLi\PythonWork\xinan_ui\config\jdzapp.yml').read_yaml()['条件单']
class EnterTjd(PageHandle):
    def __init__(self,driver):
        self.driver=driver
        super().__init__(self.driver)

    def enter_tjd(self,type):
        #进入首页
        self.click_button(data_eles[0]['首页'])
        time.sleep(2)
        try:
            self.click_button(data_eles[9]['新股提示弹窗'])
            time.sleep(1)
        except:
            print('没出现新股提示弹窗')
        #向左滑动三次
        if type=='普通':
            for i in range(2):
                self.slide_left()
                time.sleep(0.5)
            time.sleep(1)
            #点击普通条件单入口
            self.click_button(data_eles[1]['普通条件单入口'])
            time.sleep(1)
        elif type=='信用':
            for i in range(3):
                self.slide_left()
                time.sleep(0.5)
            time.sleep(1)
            #点击信用条件单入口
            self.click_button(data_eles[10]['信用条件单入口'])
            time.sleep(1)
